package my.design.proxy;

import net.sf.cglib.proxy.Enhancer;

import java.lang.reflect.Proxy;

/**
 * @author zp
 * @version 1.0
 * @description: TODO
 * @date 2022/10/17 19:15
 */
public class CglibProxyFactory {
    public static <T> T getProxiedObject(Class clazz) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(clazz);
        enhancer.setCallback(new CglibProxy());
        T proxied = (T) enhancer.create();
        return proxied;
    }
}
